package com.example.userwallet.service;

import com.example.userwallet.mapper.WalletMapper;
import com.example.userwallet.req.WalletQueryReq;
import com.example.userwallet.resp.WalletQueryResp;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class WalletService {

    @Resource
    WalletMapper walletMapper;

    // 查询用户钱包余额
    public WalletQueryResp getAccount(WalletQueryReq req){
        return walletMapper.selectAccountById(req.getId());
    }

    // 用户消费100元
    public void consume(){
        walletMapper.consume();
    }

    // 用户退款20元
    public void drawback(){
        walletMapper.drawback();
    }
}
